package com.zx.baofu.alcohol.service.impl;

import com.zx.baofu.alcohol.mapper.PeriodsMapper;
import com.zx.baofu.alcohol.model.Periods;
import com.zx.baofu.alcohol.model.Result;
import com.zx.baofu.alcohol.service.PeriodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class PeriodsServiceImpl implements PeriodsService {
    @Autowired
    PeriodsMapper periodsMapper;


    @Override
    public Result getAllPeriods() {
        List<Periods> list=periodsMapper.getAllPeriods();
        return new Result().success("查询成功",list);
    }

    @Override
    public Result updatePeriods(Long id,String startDate,String endDate,String periodsName) {
        int res=periodsMapper.updatePeriods(id,startDate,endDate,periodsName);
        if(res>0){
            return new Result().success("修改成功",res);
        }
        return new Result().fail("修改失败",res);
    }
}
